﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BeatlesBlog.SimConnect;
using FA.Library.Sim.Aircraft;
using System.Reflection;
using FA.Library.Util;
using System.ComponentModel;

namespace FA.Plugins.FSXPlugin.Sim.Aircraft
{
    [DataStruct()]
    public class FSXAircraftVelocity : BaseCloneable, AircraftVelocity
    {
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// The current G force.
        /// </summary>
        [DataItem("G FORCE", "gforce")]
        public float GForce
        {
            get { return _gForce; }
            set
            {
                if (_gForce != value)
                {
                    _gForce = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("GForce"));
                }
            }
        }
        private float _gForce;

        /// <summary>
        /// Speed relative to the earth's surface.
        /// </summary>
        [DataItem("GROUND VELOCITY", "knots")]
        public float GroundVelocity
        {
            get { return _groundVelocity; }
            private set
            {
                if (_groundVelocity != value)
                {
                    _groundVelocity = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("GroundVelocity"));
                }
            }
        }
        private float _groundVelocity;

        /// <summary>
        /// True longitudinal speed, relative to aircraft axis.
        /// </summary>
        [DataItem("VELOCITY BODY Z", "feet per second")]
        public float VelocityBodyZ
        {
            get { return _velocityBodyZ; }
            set
            {
                if (_velocityBodyZ != value)
                {
                    _velocityBodyZ = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("VelocityBodyZ"));
                }
            }
        }
        private float _velocityBodyZ;

        /// <summary>
        /// True lateral speed, relative to aircraft axis.
        /// </summary>
        [DataItem("VELOCITY BODY X", "feet per second")]
        public float VelocityBodyX
        {
            get { return _velocityBodyX; }
            set
            {
                if (_velocityBodyX != value)
                {
                    _velocityBodyX = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("VelocityBodyX"));
                }
            }
        }
        private float _velocityBodyX;

        /// <summary>
        /// True vertical speed, relative to aircraft axis.
        /// </summary>
        [DataItem("VELOCITY BODY Y", "feet per second")]
        public float VelocityBodyY
        {
            get { return _velocityBodyY; }
            set
            {
                if (_velocityBodyY != value)
                {
                    _velocityBodyY = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("VelocityBodyY"));
                }
            }
        }
        private float _velocityBodyY;

        /// <summary>
        /// Speed relative to earth, in North/South direction.
        /// </summary>
        [DataItem("VELOCITY WORLD Z", "feet per second")]
        public float VelocityWorldZ
        {
            get { return _velocityWorldZ; }
            set
            {
                if (_velocityWorldZ != value)
                {
                    _velocityWorldZ = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("VelocityWorldZ"));
                }
            }
        }
        private float _velocityWorldZ;

        /// <summary>
        /// Speed relative to earth, in East/West direction.
        /// </summary>
        [DataItem("VELOCITY WORLD X", "feet per second")]
        public float VelocityWorldX
        {
            get { return _velocityWorldX; }
            set
            {
                if (_velocityWorldX != value)
                {
                    _velocityWorldX = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("VelocityWorldX"));
                }
            }
        }
        private float _velocityWorldX;

        /// <summary>
        /// Speed relative to earth, in vertical direction.
        /// </summary>
        [DataItem("VELOCITY WORLD Y", "feet per second")]
        public float VelocityWorldY
        {
            get { return _velocityWorldY; }
            set
            {
                if (_velocityWorldY != value)
                {
                    _velocityWorldY = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("VelocityWorldY"));
                }
            }
        }
        private float _velocityWorldY;

        /// <summary>
        /// Acceleration relative to aircraft axix, in east/west direction.
        /// </summary>
        [DataItem("ACCELERATION BODY X", "feet per second squared")]
        public float AccelerationBodyX
        {
            get { return _accelerationBodyX; }
            set
            {
                if (_accelerationBodyX != value)
                {
                    _accelerationBodyX = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("AccelerationBodyX"));
                }
            }
        }
        private float _accelerationBodyX;

        /// <summary>
        /// Acceleration relative to aircraft axis, in vertical direction.
        /// </summary>
        [DataItem("ACCELERATION BODY Y", "feet per second squared")]
        public float AccelerationBodyY
        {
            get { return _accelerationBodyY; }
            set
            {
                if (_accelerationBodyY != value)
                {
                    _accelerationBodyY = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("AccelerationBodyY"));
                }
            }
        }
        private float _accelerationBodyY;

        /// <summary>
        /// Acceleration relative to aircraft axis, in north/south direction.
        /// </summary>
        [DataItem("ACCELERATION BODY Z", "feet per second squared")]
        public float AccelerationBodyZ
        {
            get { return _accelerationBodyZ; }
            set
            {
                if (_accelerationBodyZ != value)
                {
                    _accelerationBodyZ = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("AccelerationBodyZ"));
                }
            }
        }
        private float _accelerationBodyZ;

        /// <summary>
        /// Acceleration relative to earth, in east/west direction.
        /// </summary>
        [DataItem("ACCELERATION WORLD X", "feet per second squared")]
        public float AccelerationWorldX
        {
            get { return _accelerationWorldX; }
            set
            {
                if (_accelerationWorldX != value)
                {
                    _accelerationWorldX = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("AccelerationWorldX"));
                }
            }
        }
        private float _accelerationWorldX;

        /// <summary>
        /// Acceleration relative to earch, in vertical direction.
        /// </summary>
        [DataItem("ACCELERATION WORLD Y", "feet per second squared")]
        public float AccelerationWorldY
        {
            get { return _accelerationWorldY; }
            set
            {
                if (_accelerationWorldY != value)
                {
                    _accelerationWorldY = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("AccelerationWorldY"));
                }
            }
        }
        private float _accelerationWorldY;

        /// <summary>
        /// Acceleration relative to earth, in north/south direction.
        /// </summary>
        [DataItem("ACCELERATION WORLD Z", "feet per second squared")]
        public float AccelerationWorldZ
        {
            get { return _accelerationWorldZ; }
            set
            {
                if (_accelerationWorldZ != value)
                {
                    _accelerationWorldZ = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("AccelerationWorldZ"));
                }
            }
        }
        private float _accelerationWorldZ;

        /// <summary>
        /// Acceleration relative to aircraft axis, in east/west direction.
        /// </summary>
        [DataItem("ROTATION VELOCITY BODY X", "feet per second")]
        public float RotationalVelocityX
        {
            get { return _rotationalVelocityX; }
            set
            {
                if (_rotationalVelocityX != value)
                {
                    _rotationalVelocityX = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("RotationVelocityBodyX"));
                }
            }
        }
        private float _rotationalVelocityX;

        /// <summary>
        /// Acceleration relative to aircraft axis, in vertical direction.
        /// </summary>
        [DataItem("ROTATION VELOCITY BODY Y", "feet per second")]
        public float RotationalVelocityY
        {
            get { return _rotationalVelocityY; }
            set
            {
                if (_rotationalVelocityY != value)
                {
                    _rotationalVelocityY = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("RotationVelocityBodyY"));
                }
            }
        }
        private float _rotationalVelocityY;

        /// <summary>
        /// Acceleration relative to aircraft axis, in north/south direction.
        /// </summary>
        [DataItem("ROTATION VELOCITY BODY Z", "feet per second")]
        public float RotationalVelocityZ
        {
            get { return _rotationalVelocityZ; }
            set
            {
                if (_rotationalVelocityZ != value)
                {
                    _rotationalVelocityZ = value;
                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs("RotationVelocityBodyZ"));
                }
            }
        }
        private float _rotationalVelocityZ;
    }
}